import request from '@/utils/request'

export function fetchList(params) {
  return request({
    url: '/supplier/list',
    method: 'get',
    params: params
  })
}

export function createSupplier(data) {
  return request({
    url: '/supplier/create',
    method: 'post',
    data: data
  })
}

export function updateSupplier(id, data) {
  return request({
    url: '/supplier/update/' + id,
    method: 'put',
    data: data
  })
}

export function deleteSupplier(id) {
  return request({
    url: '/supplier/delete/' + id,
    method: 'delete'
  })
}

export function getSupplier(id) {
  return request({
    url: '/supplier/detail/' + id,
    method: 'get'
  })
}

export function updateStatus(id, status) {
  return request({
    url: '/supplier/updateStatus/' + id,
    method: 'post',
    data: { status }
  })
}

export function getMemberByUid(uid) {
  return request({
    url: '/supplier/getMemberByUid',
    method: 'get',
    params: { uid }
  })
}

export function getAddresses(params) {
  return request({
    url: '/supplier/getAddresses',
    method: 'get',
    params: params
  })
}

export function getPickupPoints(vendorId, params) {
  return request({
    url: '/supplier/pickupPoints/' + vendorId,
    method: 'get',
    params: params
  })
}
